var vertexShader = `
    attribute vec4 a_Position;
    void main(){
        gl_Position = a_Position;
        gl_PointSize = 20.0;
    }
`
var fragmentShader = `
    void main(){
        gl_FragColor = vec4(1.0,0.0,0.0,1.0);
    }    
`

function load(){
    var gl = getWebGLContext('webgl')
    if(!gl){
       console.log("Get WebGL Context Failed")
       return
    }
    gl.clearColor(0.0,0.0,0.0,1.0)
    gl.clear(gl.COLOR_BUFFER_BIT);
    var program =  buildProgram(gl,vertexShader,fragmentShader)

    // 获取a_Position的存储位置
    var a_Position = gl.getAttribLocation(program,'a_Position')
    if(a_Position < 0){
        console.log("Get a_Position Failed")
        return
    }

    // 给attribute变量赋值
    gl.vertexAttrib3f(a_Position,0.5,0.5,0.0)

    //绘制点
    gl.drawArrays(gl.POINTS,0,1)

    var vertices = [0.1,0.0,0.2,0.0,0.3,0.0,0.4,0.0,0.5,0.0];
    for(var i = 0;i < vertices.length;i += 2){
        gl.vertexAttrib1f(a_Position, vertices [i], vertices [i + 1],0.0);
        gl.drawArrays(gl.POINTS, 0, 1);//绘制点
    }

}


